# src/plot_storage.py
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns

# 解决中文乱码
plt.rcParams['font.sans-serif'] = ['SimHei']   # 或者 'Microsoft YaHei'
plt.rcParams['axes.unicode_minus'] = False

df = pd.read_csv("docs/storage_compare.csv")
plt.figure(figsize=(5, 3))
sns.barplot(x='index', y='value', hue='variable', data=pd.melt(df, id_vars=['index']))
plt.title("全量 vs 增量 存储大小")
plt.xlabel("配置版本")
plt.ylabel("字节数")
plt.tight_layout()
plt.savefig("docs/fig_storage_compare.png", dpi=300)
print("图表已保存到 docs/fig_storage_compare.png")